/**
 * @author Steven
 * 
 * Frame for pop-up to add new drink or producer. Select radio button
 * for desired class, the available fields are editable. If drink
 * selected, Producer frame is opened.
 */

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package gui;

import javax.swing.ButtonGroup;
import javax.swing.JOptionPane;

import model.DatabaseCommunicator;

/**
 *
 * @author Jeff
 */
public class NewEntryFrame extends javax.swing.JFrame {
	
	/**
     * Creates new form NewEntryFrame
     */
    public NewEntryFrame() {
        initComponents();
    }

    private void initComponents() {

        typeLabel = new javax.swing.JLabel();
        typeField = new javax.swing.JTextField();
        nameLabel = new javax.swing.JLabel();
        nameTextField = new javax.swing.JTextField();
        beerRadio = new javax.swing.JRadioButton();
        wineRadio = new javax.swing.JRadioButton();
        liquorRadio = new javax.swing.JRadioButton();
        breweryRadio = new javax.swing.JRadioButton();
        wineryRadio = new javax.swing.JRadioButton();
        distilleryRadio = new javax.swing.JRadioButton();
        drinksLabel = new javax.swing.JLabel();
        producersLabel = new javax.swing.JLabel();
        priceLabel = new javax.swing.JLabel();
        priceField = new javax.swing.JTextField();
        proofLabel = new javax.swing.JLabel();
        proofField = new javax.swing.JTextField();
        jSeparator1 = new javax.swing.JSeparator();
        numDrankLabel = new javax.swing.JLabel();
        numberField = new javax.swing.JTextField();
        flavoringsLabel = new javax.swing.JLabel();
        flavoringsField = new javax.swing.JTextField();
        pairingsLabel = new javax.swing.JLabel();
        pairingsField = new javax.swing.JTextField();
        drinkTypeLabel = new javax.swing.JLabel();
        fruitLabel = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        fruitCheckbox = new javax.swing.JCheckBox();
        yearLabel = new javax.swing.JLabel();
        yearField = new javax.swing.JTextField();
        distilledLabel = new javax.swing.JLabel();
        distilledField = new javax.swing.JTextField();
        jSeparator3 = new javax.swing.JSeparator();
        yearEstablishedLabel = new javax.swing.JLabel();
        websiteLabel = new javax.swing.JLabel();
        founderLabel = new javax.swing.JLabel();
        microLabel = new javax.swing.JLabel();
        yearEstField = new javax.swing.JTextField();
        websiteField = new javax.swing.JTextField();
        founderField = new javax.swing.JTextField();
        microCheckbox = new javax.swing.JCheckBox();
        productionLabel = new javax.swing.JLabel();
        productionField = new javax.swing.JTextField();
        acresLabel = new javax.swing.JLabel();
        winemakerLabel = new javax.swing.JLabel();
        acresField = new javax.swing.JTextField();
        makerField = new javax.swing.JTextField();
        submitButton = new javax.swing.JButton();
        
        ButtonGroup group = new ButtonGroup();
        group.add(beerRadio);
        group.add(wineRadio);
        group.add(liquorRadio);
        group.add(breweryRadio);
        group.add(wineryRadio);
        group.add(distilleryRadio);

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);        
        
        // disable all buttons to start with
    	priceField.setEnabled(false);
    	proofField.setEnabled(false);
    	numberField.setEnabled(false);
    	flavoringsField.setEnabled(false);
    	pairingsField.setEnabled(false);
    	fruitCheckbox.setEnabled(false);
    	yearField.setEnabled(false);
    	distilledField.setEnabled(false);
    	typeField.setEnabled(false);
    	yearEstField.setEnabled(false);
    	websiteField.setEnabled(false);
    	founderField.setEnabled(false);
    	microCheckbox.setEnabled(false);
    	productionField.setEnabled(false);
    	acresField.setEnabled(false);
    	makerField.setEnabled(false);
        

        //default null values
    	priceField.setText(0 + "");
    	proofField.setText(0 + "");
    	numberField.setText(0 + "");
    	flavoringsField.setText("N/A");
    	pairingsField.setText("N/A");
    	yearField.setText("N/A");
    	distilledField.setText("N/A");
    	typeField.setText("N/A");
    	yearEstField.setText(0 + "");
    	websiteField.setText("N/A");
    	founderField.setText("N/A");
    	productionField.setText(0 + "");
    	acresField.setText(0 + "");
    	makerField.setText("N/A");
        
        
    	
        drinkTypeLabel.setText("Type:");
        
        typeLabel.setText("Class:");

        nameLabel.setText("Name:");

        beerRadio.setText("Beer");

        wineRadio.setText("Wine");

        liquorRadio.setText("Liquor");

        breweryRadio.setText("Brewery");

        wineryRadio.setText("Winery");

        distilleryRadio.setText("Distillery");

        drinksLabel.setText("Drinks");

        producersLabel.setText("Producers");

        priceLabel.setText("Price:");

        proofLabel.setText("Proof:");

        numDrankLabel.setText("Number Drank:");

        flavoringsLabel.setText("Flavorings:");

        pairingsLabel.setText("Pairings:");

        fruitLabel.setText("Fruit Wine:");
        
        yearLabel.setText("Year:");

        jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);

        fruitCheckbox.setText("Yes");


        distilledLabel.setText("Distilled From:");

        jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);

        yearEstablishedLabel.setText("Year Established: ");

        websiteLabel.setText("Website:");

        founderLabel.setText("Founder:");

        microLabel.setText("Micro Brewery:");

        microCheckbox.setText("Yes");

        productionLabel.setText("Current Production:");

        acresLabel.setText("Acres:");

        winemakerLabel.setText("Wine Maker:");

        submitButton.setText("Submit");
        submitButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	// All of these will be defaults for attributes at least the name
            	// and table name will be changed so the create should always work
            	// as long as there is a value in the name field
            	String tableName = "NA";
            	String name = nameTextField.getText();
            	String specificValues = "NA";
            	
            	if(name.length() != 0){
                	if(!beerRadio.isSelected() && !wineRadio.isSelected() && !liquorRadio.isSelected()
                			&& !wineryRadio.isSelected() && !breweryRadio.isSelected() && !distilleryRadio.isSelected()){
                    	JOptionPane.showMessageDialog(NewEntryFrame.this, "Please select a Class.");
                    }
	            	if(breweryRadio.isSelected() || wineryRadio.isSelected() || distilleryRadio.isSelected()){
	            		int yearEstablished = Integer.parseInt(yearEstField.getText());
	            		String website = websiteField.getText();
	            		
	                	if (currentButton.equals(breweryRadio)){
	                		tableName = "brewery";
	                		int microMacro;
	                		if (fruitCheckbox.isSelected()){
	                			microMacro = 1;
	                		} else {
	                			microMacro = 0;
	                		}
	                		specificValues = String.valueOf(microMacro);
	                		
	                	} else if (currentButton.equals(wineryRadio)){
	                		tableName = "winery";
	                		int currentProduction = Integer.parseInt(productionField.getText());
	                		int acres = Integer.parseInt(acresField.getText());
	                		String wineMaker = makerField.getText();
	                		specificValues = currentProduction +"','"+ acres +"','"+
	                							wineMaker;
	                		
	                	} else if (currentButton.equals(distilleryRadio)){
	                		tableName = "distillery";
	                		String founder = founderField.getText();
	                		specificValues = founder;
	                		
	                	} else {
	                		System.out.println("Should never reach here - Producers");
	                	}
	                	
	            		String stmt = "INSERT INTO "+ tableName + " VALUES (" +"'"+ name +
	            				"','"+ yearEstablished +"','"+ website +"','"+ 
	            				specificValues + "')";
	            		DatabaseCommunicator.dbc.create(stmt);
	            		
	            		LocationFrame lf = new LocationFrame();
	            		LocationFrame.dbc = DatabaseCommunicator.dbc;
	            		lf.setVisible(true);
	            		lf.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	            		
	            	}
	            	else{
	                	String type = "NA";
	            		Double price = Double.parseDouble(priceField.getText());
	            		type = typeField.getText();
	            		int numberDrank = Integer.parseInt(numberField.getText());
	            		int proof = Integer.parseInt(proofField.getText());
	            		
	                	if (currentButton.equals(beerRadio)){
	                		tableName = "beer";
	                		String flavorings = flavoringsField.getText();
	                		specificValues = flavorings;
	                		
	                	} else if (currentButton.equals(wineRadio)){
	                		tableName = "wine";
	                		int fruitWine;
	                		int year = Integer.parseInt(yearField.getText());
	                		if (fruitCheckbox.isSelected()){
	                			fruitWine = 1;
	                		} else {
	                			fruitWine = 0;
	                		}
	                		String pairings = pairingsField.getText();
	                		specificValues = year +"','"+ fruitWine +
	                				"','"+ pairings;
	                		
	                	} else if (currentButton.equals(liquorRadio)){
	                		tableName = "spirit";
	                		String distilledFrom = distilledField.getText();
	                		specificValues = distilledFrom;
	                	
	                	} else {
	                		System.out.println("Should never reach here - drinks");
	                	}
	                	
	            		String stmt = "INSERT INTO "+ tableName + " VALUES ('"+ name +
	            				"','"+ price +"','"+ type +"','"+ numberDrank +
	            				"','"+ proof +"','"+ specificValues + "')";

	            		DatabaseCommunicator.dbc.currAddType = tableName;
	            		DatabaseCommunicator.dbc.currDrink = name;
	            		DatabaseCommunicator.dbc.create(stmt);
	            		
	            		ProducerFrame pf = new ProducerFrame();
	            		ProducerFrame.dbc = DatabaseCommunicator.dbc;
	            		pf.setVisible(true);
	            		pf.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
	            		
	            	}
	        		dispose();
	            }
            	else if(name.length() == 0){
                	JOptionPane.showMessageDialog(NewEntryFrame.this, "Please enter a Name.");
                }
            }
        });
        
        beerRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = beerRadio;
            	priceField.setEnabled(true);
            	proofField.setEnabled(true);
            	numberField.setEnabled(true);
            	flavoringsField.setEnabled(true);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(false);
            	typeField.setEnabled(true);
            	
            	yearEstField.setEnabled(false);
            	websiteField.setEnabled(false);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });
        
        wineRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = wineRadio;
            	priceField.setEnabled(true);
            	proofField.setEnabled(true);
            	numberField.setEnabled(true);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(true);
            	fruitCheckbox.setEnabled(true);
            	yearField.setEnabled(true);
            	distilledField.setEnabled(false);
            	typeField.setEnabled(true);
            	
            	yearEstField.setEnabled(false);
            	websiteField.setEnabled(false);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });
        
        liquorRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = liquorRadio;
            	priceField.setEnabled(true);
            	proofField.setEnabled(true);
            	numberField.setEnabled(true);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(true);
            	typeField.setEnabled(true);
            	
            	yearEstField.setEnabled(false);
            	websiteField.setEnabled(false);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });
        
        breweryRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = breweryRadio;
            	priceField.setEnabled(false);
            	proofField.setEnabled(false);
            	numberField.setEnabled(false);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(false);
            	typeField.setEnabled(false);
            	yearEstField.setEnabled(true);
            	websiteField.setEnabled(true);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(true);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });
        
        wineryRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = wineryRadio;
            	priceField.setEnabled(false);
            	proofField.setEnabled(false);
            	typeField.setEnabled(false);
            	numberField.setEnabled(false);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(false);
            	
            	yearEstField.setEnabled(true);
            	websiteField.setEnabled(true);
            	founderField.setEnabled(false);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(true);
            	acresField.setEnabled(true);
            	makerField.setEnabled(true);
            }
            
        });
        
        distilleryRadio.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
            	currentButton = distilleryRadio;
            	priceField.setEnabled(false);
            	proofField.setEnabled(false);
            	numberField.setEnabled(false);
            	flavoringsField.setEnabled(false);
            	pairingsField.setEnabled(false);
            	fruitCheckbox.setEnabled(false);
            	yearField.setEnabled(false);
            	distilledField.setEnabled(false);
            	typeField.setEnabled(false);
            	yearEstField.setEnabled(true);
            	websiteField.setEnabled(true);
            	founderField.setEnabled(true);
            	microCheckbox.setEnabled(false);
            	productionField.setEnabled(false);
            	acresField.setEnabled(false);
            	makerField.setEnabled(false);
            }
        });



        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(nameLabel)
                                    .addComponent(typeLabel))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 114, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(submitButton))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(beerRadio)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                        .addComponent(wineRadio)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(liquorRadio)
                                        .addGap(30, 30, 30)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                    .addComponent(producersLabel)
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addComponent(yearEstablishedLabel)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(yearEstField, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addComponent(microLabel)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                        .addComponent(microCheckbox))
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addComponent(winemakerLabel)
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(makerField, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE))
                                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                        .addGroup(layout.createSequentialGroup()
                                                            .addComponent(founderLabel)
                                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                            .addComponent(founderField))
                                                        .addGroup(layout.createSequentialGroup()
                                                            .addComponent(websiteLabel)
                                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                            .addComponent(websiteField, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                                    .addGroup(layout.createSequentialGroup()
                                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                                            .addGroup(layout.createSequentialGroup()
                                                                .addComponent(acresLabel)
                                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                                .addComponent(acresField))
                                                            .addComponent(productionLabel))
                                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                        .addComponent(productionField, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                            .addGroup(layout.createSequentialGroup()
                                                .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(breweryRadio)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                                .addComponent(wineryRadio)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(distilleryRadio)))
                                        .addGap(0, 145, Short.MAX_VALUE))))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(drinkTypeLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(typeField, javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE)))
                        .addContainerGap())
                    .addComponent(jSeparator1)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(numDrankLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(numberField, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(pairingsLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(pairingsField, javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(fruitLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(fruitCheckbox))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(proofLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(proofField))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(priceLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(priceField, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(drinksLabel, javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(flavoringsLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(flavoringsField, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(distilledLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(distilledField))
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(yearLabel)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(yearField, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(nameLabel)
                            .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(submitButton))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(typeLabel)
                            .addComponent(beerRadio)
                            .addComponent(wineRadio)
                            .addComponent(liquorRadio)
                            .addComponent(jSeparator3)))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(breweryRadio)
                            .addComponent(wineryRadio)
                            .addComponent(distilleryRadio))))
                .addGap(18, 18, 18)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(drinksLabel)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(priceLabel)
                            .addComponent(priceField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(proofLabel)
                            .addComponent(proofField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(numDrankLabel)
                            .addComponent(numberField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(flavoringsLabel)
                            .addComponent(flavoringsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(pairingsLabel)
                            .addComponent(pairingsField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(fruitLabel)
                            .addComponent(fruitCheckbox))
                        .addGap(7, 7, 7)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(yearLabel)
                            .addComponent(yearField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(distilledLabel)
                            .addComponent(distilledField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(producersLabel)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(yearEstablishedLabel)
                                .addComponent(yearEstField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(websiteLabel)
                                .addComponent(websiteField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(founderLabel)
                                .addComponent(founderField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(microLabel)
                                .addComponent(microCheckbox))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(productionLabel)
                                .addComponent(productionField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(acresLabel)
                                .addComponent(acresField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(winemakerLabel)
                                .addComponent(makerField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(drinkTypeLabel)
                    .addComponent(typeField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(42, 42, 42))
        );

        pack();
    }// </editor-fold>       

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(NewEntryFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(NewEntryFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(NewEntryFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(NewEntryFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new NewEntryFrame().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify
    private javax.swing.JRadioButton currentButton;
    private javax.swing.JTextField acresField;
    private javax.swing.JLabel acresLabel;
    private javax.swing.JRadioButton beerRadio;
    private javax.swing.JRadioButton breweryRadio;
    private javax.swing.JTextField distilledField;
    private javax.swing.JLabel distilledLabel;
    private javax.swing.JRadioButton distilleryRadio;
    private javax.swing.JLabel drinkTypeLabel;
    private javax.swing.JLabel drinksLabel;
    private javax.swing.JTextField flavoringsField;
    private javax.swing.JLabel flavoringsLabel;
    private javax.swing.JTextField founderField;
    private javax.swing.JLabel founderLabel;
    private javax.swing.JLabel fruitLabel;
    private javax.swing.JCheckBox fruitCheckbox;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JSeparator jSeparator3;
    private javax.swing.JRadioButton liquorRadio;
    private javax.swing.JTextField makerField;
    private javax.swing.JCheckBox microCheckbox;
    private javax.swing.JLabel microLabel;
    private javax.swing.JLabel nameLabel;
    private javax.swing.JTextField nameTextField;
    private javax.swing.JLabel numDrankLabel;
    private javax.swing.JTextField numberField;
    private javax.swing.JTextField pairingsField;
    private javax.swing.JLabel pairingsLabel;
    private javax.swing.JTextField priceField;
    private javax.swing.JLabel priceLabel;
    private javax.swing.JLabel producersLabel;
    private javax.swing.JTextField productionField;
    private javax.swing.JLabel productionLabel;
    private javax.swing.JTextField proofField;
    private javax.swing.JLabel proofLabel;
    private javax.swing.JButton submitButton;
    private javax.swing.JTextField typeField;
    private javax.swing.JLabel typeLabel;
    private javax.swing.JTextField websiteField;
    private javax.swing.JLabel websiteLabel;
    private javax.swing.JRadioButton wineRadio;
    private javax.swing.JLabel winemakerLabel;
    private javax.swing.JRadioButton wineryRadio;
    private javax.swing.JTextField yearEstField;
    private javax.swing.JLabel yearEstablishedLabel;
    private javax.swing.JTextField yearField;
    private javax.swing.JLabel yearLabel;
    // End of variables declaration
}

